package com.mszlu.blog.controller;

import com.mszlu.blog.service.TagService;
import com.mszlu.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * User: SJP
 * Date: 2022/2/26
 * Time: 21:25
 *
 * @author sjp
 * Description: No Description
 */
@RestController
@RequestMapping("tags")
public class TagsController {
    @Autowired
    private TagService tagService;
    @GetMapping("hot")
    public Result hot(){
        int limit = 2;
        return tagService.hots(limit);
    }
    @GetMapping
    public Result findAll(){
        /**
         * 查询所有文章的标签
         */
        return tagService.findAll();
    }
    @GetMapping("detail")
    public Result findAllDetail(){
        /**
         * 查询所有标签的详细
         */
        return tagService.findAllDetail();
    }
    @GetMapping("detail/{id}")
    public Result findAllDetailById(@PathVariable("id") Long id){
        /**
         * 查询所有标签的详细
         */
        return tagService.findAllDetailById(id);
    }
}
